import React from 'react';
import './button.scss';

interface ButtonProps {
    text: string;
    setColor?: string;
    setBorderColor?: string;
    setBackgroundColor?: string;
    setFontSize?: string;
    onClick?: () => void;
    className?: string;
    disabled?: boolean; // 添加一个可选的disabled属性
}

const Button: React.FC<ButtonProps> = ({
    text,
    setColor,
    setBackgroundColor,
    setFontSize,
    onClick,
    className,
    setBorderColor,
    disabled = false, // 设置默认值为false，表示按钮默认不禁用
}) => {
    return (
        <button
            className={`custom-button ${className}${disabled ? 'is-disabled' : ''}`}
            style={{ color: setColor, backgroundColor: setBackgroundColor, border: `0.5px solid ${setBorderColor}`, fontSize: setFontSize }}
            onClick={!disabled ? onClick : undefined} // 当按钮禁用时，不执行onClick
            disabled={disabled}
        >
            {text}
        </button>
    );
};

export default Button;

